<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="author" content="林镭特">
    <title></title>
   
    <style>
        
    </style>
</head>
<body>
    <!-- 1，用for循环创建table(6行*8列)。 -->
<script>

var table = document.createElement("table");
table.style.border="1px solid #000000"
table.style.borderCollapse='collapse'
document.body.appendChild(table);
    for(var i = 1; i <= 6; i++){
        var tr=document.createElement('tr')

            table.appendChild(tr)
            tr.id='tr'
            tr.style='width:51px;height:20px;'
            tr.style.border='1px solid #000000'
            
        for(var j = 1; j <= 8; j++){
            var td=document.createElement('td')
            tr.appendChild(td)
            td.id='td'
            td.style='width:51px;height:20px;'
            td.style.border='1px solid #000000'
            td.innerHTML=(i+'行'+j+'列')
        }
        document.write('<br>')
    }

   


</script>
</body>
</html>